package com.job.liushuang.HomeWork0714;

import java.io.IOException;

/**
 * @author Liushuang
 * @version 1.0
 * @since 2022-07-14 20:09:53
 */
public class UseRuntime {
    public static void main(String[] args) throws IOException {
        Runtime runtime=Runtime.getRuntime();
        //gc  exit
        System.out.println(runtime.availableProcessors());
        System.out.println(runtime.maxMemory()/1024/1024+"MB");
        System.out.println(runtime.totalMemory()/1024/1024+"MB");
        System.out.println(runtime.freeMemory()/1024/1024+"MB");

        //exec执行字符串形式的命令得到一个进程
        runtime.exec("mspaint");//此处有一个异常IOE//画图
        runtime.exec("calc");//计算器
        runtime.exec("mstsc");//远程
        //logoff 注销  shutdown -s -t 100秒后关机
        runtime.exec("D:/QQ/Bin/QQ.exe");
    }
}
